
import 'package:ycbl/model/params/params_name.dart';

class BLParams {
  final int source;
  final int tableId;
  final int pageId;
  final int mainId;
  final int mainTableId;
  final int mainPageId;
  final int start;
  final int limit;

  Map<String, dynamic> params = {};

  BLParams({
    this.source,
    this.tableId,
    this.pageId,
    this.mainId,
    this.mainTableId,
    this.mainPageId,
    this.start,
    this.limit
  }) {
    if (source != null) {
      params[BLPramsName.source] = source;
    }

    if (tableId != null) {
      params[BLPramsName.tableId] = tableId;
    }

    if (pageId != null) {
      params[BLPramsName.pageId] = pageId;
    }

    if (mainId != null) {
      params[BLPramsName.mainId] = mainId;
    }

    if (mainTableId != null) {
      params[BLPramsName.mainTableId] = mainTableId;
    }

    if (mainPageId != null) {
      params[BLPramsName.mainPageId] = mainPageId;
    }

    if (start != null) {
      params[BLPramsName.start] = start;
    }

    if (limit != null) {
      params[BLPramsName.limit] = '${limit}_flow';
    }
  }
}

/// 登录 or 注册 参数
class BLParamsLogin {
  final String phone;
  final String password;
  final String code;

  Map<String, dynamic> params = {};

  BLParamsLogin(this.phone, {this.password, this.code}) {

    params['phone'] = phone;

    if(password != null) {
      params['passWord'] = password;
    }

    if(code != null) {
      params['code'] = code;
    }
  }
}